package com.burstly.lib.component.networkcomponent.jumptap;

import com.burstly.lib.component.networkcomponent.AbstractNetworkConfigurator;
import com.burstly.lib.conveniencelayer.BurstlyAdSize;
import com.burstly.lib.util.Utils;
import com.jumptap.adtag.JtAdWidgetSettings;
import java.util.Map;

class JumptapConfigurator extends AbstractNetworkConfigurator<JtAdWidgetSettings>
{
  private static final String AD_HEIGHT_KEY = "adHeight";
  public static final String AD_SPOT = "adSpot";
  private static final String AD_TRANSPARENT_BGR_KEY = "transparentBgr";
  private static final String AD_WIDTH_KEY = "adWidth";
  public static final String APPLICATION_ID = "applicationId";
  public static final String APPLICATION_VERSION = "applicationVersion";
  public static final String DISMISS_LABEL = "dismissLabel";
  public static final String IS_INTERSTITIAL = "isInterstitial";
  private static final String PUBLISHER_ID = "publisherId";
  private static final String REFRESH_PERIOD_IN_SEC = "refreshPeriodInSec";
  private static final String SHOULD_SEND_LOCATION = "shouldSendLocation";
  private static final String SITE_ID = "siteId";
  private String mAdultContent;
  private String mAge;
  private String mApplicationId;
  private String mApplicationVersion;
  private String mCountry;
  private String mDismissLabel;
  private String mGender;
  private Integer mHeight = Integer.valueOf(-1);
  private String mHhi;
  private boolean mIsInterstitial;
  private boolean mIsPrecacheInterstitial;
  private String mLanguage;
  private String mPostalCode;
  private String mPublisherId;
  private int mRefreshPeriodInSec = 0;
  private boolean mShouldSendLocation = true;
  private String mSiteId;
  private String mSpotId;
  private boolean mTransparentBackground;
  private Integer mWidth = Integer.valueOf(-1);

  private String getAdultContentPolicy(String paramString)
  {
    if (paramString == null)
      paramString = null;
    while ((paramString.equalsIgnoreCase("allowed")) || (paramString.equalsIgnoreCase("notAllowed")) || (paramString.equalsIgnoreCase("only")))
      return paramString;
    return null;
  }

  private String getGenderType(String paramString)
  {
    if (paramString == null);
    do
    {
      return null;
      if (paramString.equalsIgnoreCase("male"))
        return "m";
    }
    while (!paramString.equalsIgnoreCase("female"));
    return "f";
  }

  private String getIncomeParamFromValue(String paramString)
  {
    if (paramString == null)
      return null;
    int i = Utils.getIntValue(paramString, Integer.valueOf(0)).intValue();
    if (i < 15000)
      return "000_015";
    if (i < 20000)
      return "015_020";
    if (i < 30000)
      return "020_030";
    if (i < 40000)
      return "030_040";
    if (i < 50000)
      return "040-050";
    if (i < 75000)
      return "050-075";
    if (i < 100000)
      return "075-100";
    if (i < 125000)
      return "100_125";
    if (i < 150000)
      return "125-150";
    return "150_OVER";
  }

  private void setAdSize(Map<String, ?> paramMap)
  {
    Object localObject = paramMap.get("adSizeCodeValue");
    if (localObject != null)
    {
      BurstlyAdSize localBurstlyAdSize = BurstlyAdSize.parseAdSize((String)localObject);
      if (localBurstlyAdSize != null)
      {
        this.mWidth = Integer.valueOf(localBurstlyAdSize.getWidth());
        this.mHeight = Integer.valueOf(localBurstlyAdSize.getHeight());
      }
    }
    int i = Utils.getIntValue((String)paramMap.get("adWidth"), Integer.valueOf(-1)).intValue();
    int j = Utils.getIntValue((String)paramMap.get("adHeight"), Integer.valueOf(-1)).intValue();
    if (i != -1)
      this.mWidth = Integer.valueOf(i);
    if (j != -1)
      this.mHeight = Integer.valueOf(j);
  }

  private void setInterstitial(Map<String, ?> paramMap)
  {
    Object localObject1 = paramMap.get("isCodeValueInterstitial");
    if (localObject1 != null)
      this.mIsInterstitial = ((Boolean)localObject1).booleanValue();
    Object localObject2 = paramMap.get("isInterstitial");
    if (localObject2 != null)
      this.mIsInterstitial = "YES".equalsIgnoreCase((String)localObject2);
  }

  protected void applyClientTargetingParamsToNetwork(Map<String, String> paramMap)
  {
    this.mAdultContent = getAdultContentPolicy((String)paramMap.get("adultContent"));
    this.mAge = String.valueOf(getAge(Utils.getDateFromString((String)paramMap.get("dateOfBirth"), "dd-MM-yyyy")));
    this.mCountry = ((String)paramMap.get("country"));
    this.mGender = getGenderType((String)paramMap.get("gender"));
    this.mHhi = getIncomeParamFromValue((String)paramMap.get("income"));
    this.mPostalCode = ((String)paramMap.get("postalCode"));
  }

  public void configure(JtAdWidgetSettings paramJtAdWidgetSettings)
  {
    paramJtAdWidgetSettings.setPublisherId(this.mPublisherId);
    if (this.mSpotId != null)
      paramJtAdWidgetSettings.setSpotId(this.mSpotId);
    if (this.mSiteId != null)
      paramJtAdWidgetSettings.setSiteId(this.mSiteId);
    if (this.mLanguage != null)
      paramJtAdWidgetSettings.setLanguage(this.mLanguage);
    if (this.mPostalCode != null)
      paramJtAdWidgetSettings.setPostalCode(this.mPostalCode);
    if (this.mCountry != null)
      paramJtAdWidgetSettings.setCountry(this.mCountry);
    if (this.mAge != null)
      paramJtAdWidgetSettings.setAge(this.mAge);
    if (this.mGender != null)
      paramJtAdWidgetSettings.setGender(this.mGender);
    if (this.mHhi != null)
      paramJtAdWidgetSettings.setHHI(this.mHhi);
    if (this.mDismissLabel != null)
      paramJtAdWidgetSettings.setDismissButtonLabel(this.mDismissLabel);
    if (this.mApplicationId != null)
      paramJtAdWidgetSettings.setApplicationId(this.mApplicationId);
    if (this.mApplicationVersion != null)
      paramJtAdWidgetSettings.setApplicationVersion(this.mApplicationVersion);
    if (this.mAdultContent != null)
      paramJtAdWidgetSettings.setAdultContentType(this.mAdultContent);
    paramJtAdWidgetSettings.setRefreshPeriod(this.mRefreshPeriodInSec);
    paramJtAdWidgetSettings.setShouldSendLocation(this.mShouldSendLocation);
    if (this.mWidth.intValue() != -1)
      paramJtAdWidgetSettings.setWidth(this.mWidth.intValue());
    if (this.mHeight.intValue() != -1)
      paramJtAdWidgetSettings.setHeight(this.mHeight.intValue());
    if (this.mTransparentBackground)
      paramJtAdWidgetSettings.setBackgroundColor(0);
  }

  boolean isInterstitial()
  {
    return this.mIsInterstitial;
  }

  boolean isPrecacheInterstitial()
  {
    return this.mIsPrecacheInterstitial;
  }

  public void readParameters(Map<String, ?> paramMap)
    throws IllegalArgumentException
  {
    applyClientTargetingIfAllowed(paramMap);
    this.mPublisherId = ((String)paramMap.get("publisherId"));
    Utils.checkNotNull(this.mPublisherId, "'publisherId' is unset. Set it on server.");
    setInterstitial(paramMap);
    setAdSize(paramMap);
    this.mSiteId = ((String)paramMap.get("siteId"));
    this.mSpotId = ((String)paramMap.get("adSpot"));
    this.mDismissLabel = ((String)paramMap.get("dismissLabel"));
    this.mRefreshPeriodInSec = Utils.getIntValue((String)paramMap.get("refreshPeriodInSec"), Integer.valueOf(0)).intValue();
    this.mApplicationId = ((String)paramMap.get("applicationId"));
    this.mApplicationVersion = ((String)paramMap.get("applicationVersion"));
    this.mShouldSendLocation = Boolean.parseBoolean((String)paramMap.get("shouldSendLocation"));
    this.mTransparentBackground = Boolean.parseBoolean((String)paramMap.get("transparentBgr"));
    this.mLanguage = ((String)paramMap.get("language"));
    Object localObject1 = paramMap.get("postalCode");
    String str1;
    String str2;
    label237: String str3;
    label266: String str5;
    label301: String str6;
    label330: String str7;
    if (localObject1 != null)
    {
      str1 = (String)localObject1;
      this.mPostalCode = str1;
      Object localObject2 = paramMap.get("country");
      if (localObject2 == null)
        break label380;
      str2 = (String)localObject2;
      this.mCountry = str2;
      Object localObject3 = paramMap.get("age");
      if (localObject3 == null)
        break label389;
      str3 = (String)localObject3;
      this.mAge = str3;
      String str4 = getGenderType((String)paramMap.get("gender"));
      if (str4 == null)
        break label398;
      str5 = (String)str4;
      this.mGender = str5;
      Object localObject4 = paramMap.get("hhi");
      if (localObject4 == null)
        break label407;
      str6 = (String)localObject4;
      this.mHhi = str6;
      str7 = getAdultContentPolicy((String)paramMap.get("adultContent"));
      if (str7 == null)
        break label416;
    }
    label389: label398: label407: label416: for (String str8 = (String)str7; ; str8 = this.mAdultContent)
    {
      this.mAdultContent = str8;
      return;
      str1 = this.mPostalCode;
      break;
      label380: str2 = this.mCountry;
      break label237;
      str3 = this.mAge;
      break label266;
      str5 = this.mGender;
      break label301;
      str6 = this.mHhi;
      break label330;
    }
  }

  void setPrecacheInterstitial(boolean paramBoolean)
  {
    this.mIsPrecacheInterstitial = paramBoolean;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.jumptap.JumptapConfigurator
 * JD-Core Version:    0.6.2
 */